package greedy;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class maxSubArray {
    public int maxSubArray(int[] nums) {
        int reslut = Integer.MIN_VALUE;
        int count = 0;
        for (int num : nums) {
            count += num;
            if (count > reslut) {
                reslut = count;
            }
            if (count <= 0) {
                count = 0;
            }
        }
        return reslut;
    }
}
